package com.pengtu.gsj.controller.system;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.pengtu.gsj.controller.base.BaseController;
import com.pengtu.gsj.entity.app.Bannerbase;
import com.pengtu.gsj.service.system.BannerbaseService;
import com.pengtu.gsj.utils.web.SpringMvcUtils;

/**
 * 
 * 
 * BannerbaseController
 * 
 * 2017年4月20日 上午11:04:00
 * 
 * @version 1.0.0
 *
 */
@Controller
@RequestMapping("/bannerbase/")
public class BannerbaseController extends BaseController {

	@Autowired
	private BannerbaseService bannerbaseService;
	
	/**
	 * 
	 * saveBannerBase:
	 * 适用:保存对象
	 * @param bannerbase 对象
	 * @param attributes 返回信息
	 * @return 页面
	 * @exception 
	 * @since  1.0.0
	 */
	@RequestMapping(value = "save",method=RequestMethod.POST)
	public String saveBannerBase(Bannerbase bannerbase,RedirectAttributes attributes) {
		if(bannerbase != null){
			bannerbaseService.saveBannerbase(bannerbase);
			attributes.addFlashAttribute("msg", "保存成功！");
		}
		return "redirect:/bannerbase/show.do";
	}
	
	@RequestMapping("show")
	public String bannerbaseDemo(Model model) {
		String msg = SpringMvcUtils.getParameter("msg");
		if (StringUtils.isNotEmpty(msg)) {
			model.addAttribute("msg", msg);
		}
		return "banner/bannerDemo";
	}
	
	/**
	 * 
	 * bannerbaseInput:
	 * 适用:保存页面
	 * @return 
	 * @exception 
	 * @since  1.0.0
	 */
	@RequestMapping("input")
	public String bannerbaseInput() {
		return "banner/bannerbaseInput";
	}


}
